package com.zzj.controller;

import com.github.pagehelper.PageInfo;
import com.zzj.bean.ModelBean;
import com.zzj.service.ModelService;
import com.zzj.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api
//@CrossOrigin
@RequestMapping("model")
public class ModelController {
    @Autowired
    private ModelService modelService;

    @GetMapping("findAll")
    public PageInfo<ModelBean> findAll(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "5") int pageSize
    ){
        return modelService.findAll(pageNum,pageSize);
    }

    @PostMapping("updateModel")
    @ApiOperation("提交粘型表")
    public Result updateModel(@RequestBody ModelBean modelBean){
        System.out.println("modelBean = " + modelBean);
        return modelService.updateModel(modelBean);
    }
}
